package com.yanqu.road.entity.activity.unionChest;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;


@FieldTypeAnnotation(tableName = "t_c_unionchest_box")
public class CrossUnionChestBoxData extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "商会id", select = true, update = true)
    private String unionId;
    @FieldTypeAnnotation(desc = "宝箱id", select = true, update = true)
    private long boxId;

    @FieldTypeAnnotation(desc = "宝箱类型")
    private int boxType;
    @FieldTypeAnnotation(desc = "分享玩家id")
    private long shareUserId;
    @FieldTypeAnnotation(desc = "分享时间ms")
    private long shareTime;
    @FieldTypeAnnotation(desc = "宝箱列表")
    private Map<Integer, UnionChestBoxInfo> boxInfoMap = new ConcurrentHashMap<>();

    public CrossUnionChestBoxData(int activityId, String unionId, long boxId) {
        this.activityId = activityId;
        this.unionId = unionId;
        this.boxId = boxId;
        setInsertOption();
    }

    public CrossUnionChestBoxData() {
    }

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public String getUnionId() {
        return unionId;
    }

    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }

    public long getBoxId() {
        return boxId;
    }

    public void setBoxId(long boxId) {
        this.boxId = boxId;
    }

    public int getBoxType() {
        return boxType;
    }

    public void setBoxType(int boxType) {
        this.boxType = boxType;
    }

    public long getShareUserId() {
        return shareUserId;
    }

    public void setShareUserId(long shareUserId) {
        this.shareUserId = shareUserId;
    }

    public long getShareTime() {
        return shareTime;
    }

    public void setShareTime(long shareTime) {
        this.shareTime = shareTime;
    }

    public Map<Integer, UnionChestBoxInfo> getBoxInfoMap() {
        return boxInfoMap;
    }

    public void setBoxInfoMap(ConcurrentHashMap<Integer, UnionChestBoxInfo> boxInfoMap) {
        this.boxInfoMap = boxInfoMap;
    }

    public void addBoxInfo(UnionChestBoxInfo boxInfo){
        this.boxInfoMap.put(boxInfo.getId(), boxInfo);
        setUpdateOption();
    }
}
